//资料审核
import { View, Text, Image } from "@tarojs/components";
import "./index.scss";
import React, { useState, useEffect } from "react";
import store from "../../store";
import { observer } from "mobx-react";
import Taro, { getStorageSync } from "@tarojs/taro";
let Photo = () => {
  let [textData, setTextData] = useState([
    { id: 0, key: "所属拼团点" },
    { id: 1, key: "门店名称" },
    { id: 2, key: "社会统一信用代码" },
    { id: 3, key: "团长" },
    { id: 4, key: "联系电话" },
    { id: 5, key: "身份证号" },
    { id: 6, key: "门店地址" },
    { id: 7, key: "邀请码" }
  ]);
  let [imgData, setImgData] = useState([]);
  const [userImg, setUserImg] = useState(Taro.getStorageSync("userImg"));
  useEffect(() => {
    setImgData([...store.s_wh.imgMeans]);
    let data = textData.map((v, i) => {
      v.value = store.s_wh.textMeans[i].value;
      return v;
    });
    data.push({ id: 9, key: "联系电话", value: store.s_wh.user.phone });
    setTextData(data);
    if (Taro.getStorageSync("userImg")) {
      setUserImg(Taro.getStorageSync("userImg"));
    }
  }, []);

  let TextMean = () =>
    textData.map(v => (
      <View key={v.id}>
        <Text>{v.key}：</Text>
        <Text>{v.value}</Text>
      </View>
    ));
  let ImgMean = () => imgData.map(v => <Image src={v}></Image>);
  return (
    <View className="means">
      <View className="tit">
        <View>审核中，请耐心等待</View><View><Image src={userImg}></Image></View>
      </View>
      <View className="text">
        <TextMean></TextMean>
      </View>
      <View className="img">
        <ImgMean></ImgMean>
      </View>
      <View style={{ color: "#F23A3A", textAlign: "center",marignTop:"50px" }}>
        请注意接听088开头的审核电话
      </View>
    </View>
  );
};
export default observer(Photo);
